using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MCromwell.StaffIntranet.DTO;

namespace MCromwell.StaffIntranet.UI
{
    public partial class ErrorSummary : UserControl
    {
        
        private string cssClass = "error-summary";

        public string CssClass
        {
            get { return cssClass; }
            set { cssClass = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void DisplaySummaryUsing(NotificationDTO notification)
        {
            if (notification.HasErrors)
            {
                BulletedList errorList = new BulletedList();
                errorList.CssClass = cssClass;

                foreach (ErrorDTO error in notification.Errors)
                {
                    errorList.Items.Add(error.Message);    
                }

                Controls.Add(errorList);
            }
        }

    }
}